//
//  IMMacro.h
//  WSIM
//
//  Created by gray on 2017/5/25.
//  Copyright © 2017年 Gray_Gao. All rights reserved.
//

#ifndef IMMacro_h
#define IMMacro_h

#pragma mark - setColor 设置颜色
#define IM_SetColorFromIntRBG(RED, GREEN, BLUE) [UIColor colorWithRed:RED/255.0 green:GREEN/255.0 blue:BLUE/255.0 alpha:1.0]
/**0x5C76A2*/
#define IM_SetColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define IM_SetColorFromRGBA(r,g,b,a) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:(a)]

/** DEBUG LOG  **/
#ifdef DEBUG
#define IMLOG(format, ...) printf("class: <%p %s:(%d) > method: %s \n%s\n", self, [[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, __PRETTY_FUNCTION__, [[NSString stringWithFormat:(format), ##__VA_ARGS__] UTF8String] )
#else
#define IMLOG(format, ...)
#endif


/** 手机屏幕 宽和高  **/
#define IM_SCREEN_FRAME           [[UIScreen mainScreen] bounds]
#define IM_SCREEN_FRAME_HEIGHT   [[UIScreen mainScreen] bounds].size.height
#define IM_SCREEN_FRAME_WIDTH     [[UIScreen mainScreen] bounds].size.width


/** 系统版本号  **/
#define IM_SYSTEM_VERSION  [[UIDevice currentDevice] systemVersion]

/** 系统语言  **/
#define IM_SYSTEM_LANGUAGE ([[NSLocale preferredLanguages] objectAtIndex:0])

/** 字符串不为NULL  **/
#define IM_STR_NOT_NULL(x) ((x) == nil || [(x) isKindOfClass:[NSNull class]] ? @"" : (x))

/** 获取通知中心  **/
#define IM_NotificationCenter [NSNotificationCenter defaultCenter]

/** 获取UserDefaults  **/
#define IM_UserDefaults     [NSUserDefaults standardUserDefaults]

/** 获取AppDelegate  **/
#define IM_AppDelegate      [UIApplication sharedApplication].delegate

/** 设置View圆角  **/
#define WS_ViewBorderRadius(View, Radius, Width, Color)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES];\
[View.layer setBorderWidth:(Width)];\
[View.layer setBorderColor:[Color CGColor]]


/** 获取String内容 **/
#define IM_GetStringFromIMStringWithKey(key)   [[WSLanguageTool sharedInstance] getStringForKey:key withTable:@"IMString"]















#endif /* IMMacro_h */
